{extend name="layout" /}

{block name="title"}<title>分类列表 - {$Think.config.site.systemname}</title>{/block}

{block name="content"}
<div class="g_6 contents_header">
    <h3 class="tab_label"><span class="icon icon-tree"></span> 分类列表</h3>
    <div><span class="label">Category list</span></div>
</div>
<div class="g_6 contents_options">
    <div class="simple_buttons">
        <div class="btnIcon"><span class="icon icon-bullhorn"> </span><a href="http://www.kancloud.cn/thinkblog/thinkblog/222138" target="_blank">帮助文档</a></div>
    </div>
    
    <div class="simple_buttons">
   		<div class="btnIcon"><span class="icon icon-plus"> </span><a href="{:url('home/category/edit')}">添加分类</a></div>
    </div>
</div>

<!-- Separator -->
<div class="g_12 separator"><span></span></div>
<!-- Table With Options on Header -->

<div class="g_12">
    <div class="widget_header wwOptions">
        <h4 class="widget_header_title"><span class="icon icon-tree"></span> 分类列表</h4>        
    </div>
    <div class="widget_contents noPadding">
        <table class="datatable tables">
            <thead>
                <tr>
                    <th width="50">CateID</th>
                    <th>类别</th>
                    <th>分类名称</th>
                    <th>分类拼音</th>
                    <th width="30">序号</th>
                    <th>状态</th>
                    <th width="120">操作管理</th>
                </tr>
            </thead>
            <tbody>
                {volist name="datalist" id="vo"}
                <tr id="id_{$vo.cate_id}">
                    <td>{$vo.cate_id}</td>
                    <td>{$vo.cate_mod}</td>
                    <td>{$vo.cate_name}</td>
                    <td>{$vo.cate_url}</td>                    
                    <td><input type="text" class="simple_field" value="{$vo.cate_order}"  onchange="javascript:changeOrder(this,{$vo.cate_id})"></td>
                    <td>{$vo.cate_status}</td>
                    <td>
                    	<div class="simple_buttons sbtnIcon">
                    	<a href="{:url('home/category/edit',['cate_id'=>$vo.cate_id])}"><span class="icon icon-pencil"> </span>编辑</a>
                    	</div>
                    	<div class="simple_buttons sbtnIcon">
                    	<a href="javascript:removeinfo({$vo.cate_id});"><span class="icon icon-bin"> </span>删除</a>
                    	</div>
                    </td>
                </tr>
                {/volist}
            </tbody>
        </table>
    </div>    
</div>
<script type="text/javascript">
//删除分类
function removeinfo(id){
    layer.confirm('您确定要删除这条信息吗？',{
        btn:['确定','取消']
    },function(){            
        $.getJSON("{:url('home/category/removeinfo')}",{'cate_id':id},function(data){
        	//console.log(data.status);
           if(data.status==0){
               layer.msg(data.msg,{icon:1});
               $("#id_"+id).empty();
           }else{
               layer.msg(data.msg,{icon:2});
           }
        });
    },function(){}
    );
}
//修改排序
function changeOrder(obj,id){
  var order = $(obj).val();
   $.getJSON("{:url('home/category/changeOrder')}",{'id':id,'order':order},function(data){
       if(data.status==0){
           layer.msg(data.msg,{icon:1});
       }else{
           layer.msg(data.msg,{icon:2});               
       }
   });
}
</script>
{/block}